package com.example.worldcup414;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import java.io.Serializable;

public class TeamDetailActivity extends AppCompatActivity {
    TextView mTvId;
    ImageView mIvPic;
    TextView mTvMatch;
    TextView mTvGoal;
    TextView mTvScore;
    TextView mTvDetail;
    private Team team;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_team_detail);

        //传递信息
        team = (Team)(getIntent().getSerializableExtra("team"));

        //Toast.makeText(this,team.getName(), Toast.LENGTH_SHORT).show();
        
        initView();
        

    }

    private void initView() {//得到控件
        mTvId = findViewById(R.id.tv_id);
        mIvPic = findViewById(R.id.iv_pic);
        mTvMatch = findViewById(R.id.tv_match);
        mTvGoal = findViewById(R.id.tv_goal);
        mTvScore = findViewById(R.id.tv_score);
        mTvDetail = findViewById(R.id.tv_detail);

        mTvId.setText(team.getId());
        mIvPic.setImageResource(getResources().getIdentifier(team.getPic(),"mipmap",getPackageName()));
        mTvMatch.setText("比赛情况:"+"胜:"+team.getSheng()+"负:"+team.getFu()+"平:"+team.getPing());

        //TODO 完善其他数据项的显示
        mTvGoal.setText("进球情况:");
        mTvScore.setText("积分为:");
        mTvDetail.setText("详细信息:");

    }
}
